const $ = document.querySelector.bind(document);
$.all = document.querySelectorAll.bind(document);

const inNetworkIP = 'http://192.168.0.105';
const outNetworkIP = 'http://bitcat.site'; // 'http://106.12.90.9';

const aTags = $.all('#app a');
const tgl_btn = $('.tgl-btn');
const qieh = $('#qieh');

Array.from(aTags).forEach(element => {
    const port = element.dataset.port;
    element.href = `${inNetworkIP}:${port}`
});

tgl_btn.addEventListener('click', () => {
    const isOut = qieh.checked;
    Array.from(aTags).forEach(element => {
        const port = element.dataset.port;
        element.href = `${isOut ? outNetworkIP : inNetworkIP}:${port}`
    });
})